my_dict = {"name": "John", "age": 30}
# 方法1
print(my_dict.get("name"))  # 输出: 'John'
print(my_dict.get("unknown"))  # 输出: None

# 方法2
if "address" in my_dict:
    print(f"address:{my_dict['address']}")
else:
    print("not key: address")


"""运行结果
John
None
not key: address

"""
